﻿using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Table;
using Microsoft.WindowsAzure.Storage.Table.DataServices;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using System.Xml.Serialization;

namespace Quiz.Model
{ 
    public class Candidate : TableServiceEntity
    {
        public Candidate()
            : this("Candidate", Guid.NewGuid().ToString())
        {
        }
        public Candidate(string partition, string rowId)
            : base(partition, rowId)
        {
        }
        public string CandidateID { get; set; }
        public string Name { get; set; }
        public string Age { get; set; }
        public string Gender { get; set; }
    }
    public class Question : TableServiceEntity
    {
        public Question()
            : this("Question", Guid.NewGuid().ToString())
        {
        }
        public Question(string partition, string rowId)
            : base(partition, rowId)
        {
            QuestionID = rowId;
        }
        public string QuestionText { get; set; }
        public string QuestionType { get; set; }
        public string QuestionID { get; set; }
        public string AnswerDom { get; set; }
        public string AnswerRowID { get; set; }
        public List<AnswerSet> GetPossibleAnswers()
        {
            return this.PossibleAnswers();
        }
        public string SetToAnswerDom(List<AnswerSet> answers)
        {
            AnswerDom = answers.ToAnswerString();
            return AnswerDom;
        }
    }
   
    [Serializable]
    public class AnswerSet :  IAnswerSet
    {
        public AnswerSet()
        {
            AnswerSetID = Guid.NewGuid().ToString();
        }
        public string AnswerSetID { get; set; }
        public string QuestionID { get; set; }
        public Char Position { get; set; }
        public string Text { get; set; }
        public QuestionType AnserType { get; set; }
    }   
    [Serializable]
    public class CandidateResponse 
    {
        public string CandidateID { get; set; }
        public string QuestionID { get; set; }
        public Char Position { get; set; }
        public string Text { get; set; }
    }
}
